<template>
  <Transition name="fade">
    <div class="warm-prompt-overlay" v-if="visible">
      <div class="warm-prompt-container" v-show="visible">
        <div class="warm-prompt-header">
          温馨提示
          <span class="close-icon" @click="handleClose">×</span>
        </div>
        
        <div class="warm-prompt-content">
          <i class="info-icon">i</i>
          <span class="prompt-text">{{ message }}</span>
        </div>
        
        <div class="warm-prompt-footer">
          <button class="confirm-btn" @click="handleConfirm">确定</button>
          <button class="cancel-btn" @click="handleClose">取消</button>
        </div>
      </div>
    </div>
  </Transition>
</template>

<script>
export default {
  name: 'WarmPrompt',
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    message: {
      type: String,
      default: ''
    }
  },
  methods: {
    handleConfirm() {
      this.$emit('confirm')
    },
    handleClose() {
      this.$emit('update:visible', false)
      this.$emit('cancel')
    }
  }
}
</script>

<style scoped>
.warm-prompt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.warm-prompt-container {
  background: white;
  border-radius: 4px;
  width: 400px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

.warm-prompt-header {
  padding: 15px;
  border-bottom: 1px solid #eee;
  position: relative;
}

.close-icon {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 20px;
  color: #909399;
}

.warm-prompt-content {
  padding: 30px 20px;
  display: flex;
  align-items: center;
}

.info-icon {
  width: 24px;
  height: 24px;
  background: #409EFF;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  font-style: normal;
}

.prompt-text {
  color: #606266;
}

.warm-prompt-footer {
  padding: 15px;
  text-align: right;
  border-top: 1px solid #eee;
}

button {
  padding: 8px 20px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  margin-left: 10px;
}

.confirm-btn {
  background: #00C853;
  color: white;
}

.confirm-btn:hover {
  background: #00B84D;
}

.cancel-btn {
  background: #f5f5f5;
  color: #606266;
}

.cancel-btn:hover {
  background: #e8e8e8;
}

.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}

.zoom-enter-active,
.zoom-leave-active {
  transition: transform 0.3s ease;
}

.zoom-enter-from,
.zoom-leave-to {
  transform: scale(0.9);
}
</style> 